package com.ihtry.service.impl;

import com.ihtry.dao.AdminDao;
import com.ihtry.pojo.Admin;
import com.ihtry.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Joker
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminDao adminDao;

    //登录
    public Admin login(Admin admin) {
        return adminDao.login(admin);
    }

    //注册
    public boolean reg(Admin admin) {
        return adminDao.reg(admin);
    }

    //查询全部
    public List<Admin> getAll() {
        return adminDao.getAll();
    }

    //通过id查询
    public Admin getAdminById(Integer id) {
        return adminDao.getAdminById(id);
    }

    //判断用户名是否存在
    public Admin getAdminByUsername(String username) {
        return adminDao.getAdminByUsername(username);
    }

    //修改用户
    public boolean updateAdmin(Admin admin) {
        return adminDao.updateAdmin(admin);
    }


    //删除用户
    public boolean deleteAdmin(Integer id) {
        return adminDao.deleteAdmin(id);
    }
}
